#ifndef PERFECTPAIRSIDEBET_H
#define PERFECTPAIRSIDEBET_H

#include "bjproto.h"

#include "BJSideBet.h"

class BJConnection;
class BJHand;
class CardMgr;
class BJSavedGame;



/******************************************************************************************************
 * kharmon.  02-13-07.  #16101.
 *
 * This class implements the logic behind the Perfect Pair side bet.  One instance of this class
 * processes and stores information for all active bets.
 ******************************************************************************************************/
class PerfectPairSideBet : public BJSideBet
{
public:
    // constructor for new blackjack game
    PerfectPairSideBet(CardMgr *pMgr, BJConnection* pConn, 
                        int32 nMaxBJBets, int32 anSideBet[BJMAXBETS]);

    // constructor for restoring a saved blackjack game
    PerfectPairSideBet(CardMgr *pMgr, BJConnection* pConn, BJSavedGame* pSaved);

    
    // called after the initial deal to determine side bet results
    virtual void calculateDealResults(char *pcGID, BJHand *phand, int32 nBJBet);
    
    // puts the sidebet results into the message buffer to be sent to client.
    virtual void sendResults();

    // called when restoring an existing game, to update the client with the sidebet state
    virtual void sendSaveState();

    // returns side bet amount for indicated blackjack game
    virtual int32 getSideBet(int32 nBJBet) { return m_anSideBets[nBJBet]; }

    // returns amount won on sidebet for indicated blackjack game
    virtual int32 getSideBetPayout(int32 nBJBet) { return m_anSideBetPayouts[nBJBet]; }

private:

    CardMgr*        m_pMgr;  

    BJConnection*   m_pConn; 

    int32           m_nMaxBJBets;                   // single or multibet blackjack?

	int32           m_anSideBets[BJMAXBETS];	    // amount bet by player
    int32           m_anSideBetPayouts[BJMAXBETS];	// amount won by player
    int32           m_anSideBetWinType[BJMAXBETS];  // perfect, colored, or mixed pair, OR no pair.

    static const int32 m_anPerfectPairPaytables [][3];  // payout odds.    
};




#endif